﻿using MediatR;
using T_settlement.Domain;
using T_settlement.Infrastructure.Interfacec;
using T_settlement.Read.API.Application.Command.InvoiceCommand;

namespace T_settlement.Read.API.Application.CommandHandlers.InvoiceCommandHandlers
{
    public class FanInvoiceCommandHandlers : IRequestHandler<FanInvoiceCommand, Invoice>
    {
        private readonly InvoiceRepository invoiceRepository;

        public FanInvoiceCommandHandlers(InvoiceRepository invoiceRepository)
        {
            this.invoiceRepository = invoiceRepository;
        }

        public async Task<Invoice> Handle(FanInvoiceCommand request, CancellationToken cancellationToken)
        {
            var list = await invoiceRepository.GetModelAsync(request.InvoiceId);
            return list;
        }
    }
}
